<template>
	<view style="padding: 0 20rpx">
		<div>
			<div class="pb-foot1">
				<section class="aui-content aui-margin-t-15 with_class no_line mt-top1">
					<div style="background-color: #fff" class="aui-card-list-content aui-text-center aui-padded-t-15 aui-padded-b-15">
						<div class="aui-font-size-22">
							{{ money }}
							<span class="aui-font-size-14 aui-margin-l-5">元</span>
						</div>

						<p class="aui-margin-b-10">
							请在
							<span class="aui-text-info aui-margin-l-5 aui-margin-r-5">00:{{ m }}:{{ s }}</span>
							内完成支付
						</p>
						<p class="aui-margin-b-10 aui-bg-default aui-margin-l-10 aui-margin-r-10 aui-padded-10">
							如以完成支付，请
							<span @click="openKF" class="aui-text-info aui-margin-l-5 aui-margin-r-5">联系客服</span>
							确认
						</p>
					</div>
				</section>

				<section class="aui-content aui-margin-t-15 with_class no_line dep-list-box">
					<div class="aui-font-size-16 aui-padded-10 aui-padded-t-5 aui-padded-b-5 aui-margin-t-10">{{ bankName }}</div>
					<ul class="aui-list aui-form-list aui-font-size-14">
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">户名:</div>
								<div class="aui-list-item-input">
									{{ accountName }}
								</div>
								<div class="aui-list-item-label-icon">
									<div class="dep-copy" @click="copy(accountName)">复制</div>
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">账号:</div>
								<div class="aui-list-item-input">
									{{ account }}
								</div>
								<div class="aui-list-item-label-icon">
									<div class="dep-copy" @click="copy(account)">复制</div>
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">金额:</div>
								<div class="aui-list-item-input">{{ money }}元</div>
								<div class="aui-list-item-label-icon">
									<div class="dep-copy" @click="copy(money)">复制</div>
								</div>
							</div>
						</li>

<!-- 						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">地址:</div>
								<div class="aui-list-item-input">
									{{ subBankName }}
								</div>
								<div class="aui-list-item-label-icon">
									<div class="dep-copy" @click="copy(subBankName)">复制</div>
								</div>
							</div>
						</li> -->
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-text-danger aui-margin-b-10">
									<i class="iconfont icon-tishi aui-margin-r-5"></i>
									转账金额务必与订单金额一致
								</div>
							</div>
						</li>
					</ul>
				</section>
				<section class="aui-content aui-margin-t-15 with_class no_line">
					<div class="aui-font-size-16 aui-padded-10 aui-padded-t-5 aui-padded-b-5 aui-margin-t-10">重要提醒</div>
					<div class="aui-card-list-content aui-padded-10">
						<p class="aui-margin-b-10">1.转账金额需与订单金额一致，否则存款无法及时到账</p>
						<p class="aui-margin-b-10">2.转账必须填写正确附言（备注），否则存款无法及时到账</p>
						<p class="aui-margin-b-10">3.下次存款时，请获取新的账号，存入旧账号将无法到账</p>
						<p class="aui-margin-b-10">4.请及时前往存款，附言（备注）有效时间只有30分钟</p>
						<p class="aui-margin-b-10">5.请勿使用支付宝、微信转账至公司账户</p>
						<p class="aui-margin-b-10">6.若存款存在疑问，请及时联系客服</p>
					</div>
				</section>
			</div>
<!-- 			<footer class="aui-bar aui-bar-tab filleted">
				<div class="dep-btn" style="margin: 0">
					<div class="aui-bar-tab-item aui-text-white" @click="openRecord">
						<div class="aui-btn aui-btn-danger aui-btn-block aui-margin-l-5" style="height: 70rpx; line-height: 70rpx; width: 98%">查看存款记录</div>
					</div>
				</div>
			</footer> -->
			<!--核心 end-->
		</div>
	</view>
</template>

<script>
import request from '@/api/request.js';
export default {
	data() {
		return {
			type: -1,
			name: '',
			money: 0,
			bankName: '',
			subBankName: '',
			account: '',
			accountName: '',
			id: '',
			copyTxt: '',
			copyCount: 0,
			update_time: 0,
			m: 0,
			s: 0
		};
	},
	onLoad(opyion) {
		if(opyion.money) {
			this.money = opyion.money;
		}
		this.update_time = Number(new Date());
		this.countdown();
		this.getInfoData();
	},
	methods: {
		countdown() {
			const end = this.update_time; // update_time是后台返的数据，代表创建订单的那一个时刻的毫秒数
			const now = new Date().getTime(); // 获取当前时间的毫秒数
			const minus = now - end;
			const m_30 = 30 * 60 * 1000; // 30分钟毫秒数，如十分钟倒计时，公式即为10*60*100，以此类推

			const differ = m_30 - minus; // 时间差

			let m = parseInt((differ / 1000 / 60) % 60);
			let s = parseInt((differ / 1000) % 60);

			this.m = m > 9 ? m : '0' + m;
			this.s = s > 9 ? s : '0' + s;

			const that = this;
			if (m >= 0 && s >= 0) {
				if (m == 0 && s == 0) {
					return;
				}
				setTimeout(function () {
					that.countdown();
				}, 1000);
			}
		},

		copy(txt) {
			uni.setClipboardData({
				data: txt,
				success: function () {
					console.log('复制成功');
				}
			});
		},
		async getInfoData(){
			let data = await request.get('/api/common/getRechargeConfigList');
			if(data.code === 1){
				this.accountName = data.data.bank_name;
				this.account = data.data.bank_num;
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.dep-copy {
	border: 1px solid red;
	height: 25px;
	line-height: 25px;
	padding: 0 6px;

	border: 1px solid #3f51b5;
	color: #3f51b5;
	border-radius: 0.2rem;
	margin-right: 0.5rem;
	line-height: normal;
	font-size: 0.6rem;
	padding: 0.1rem 0.5rem;
}
</style>
